package com.bolt.admin.module.sys.entity;

import com.bolt.support.spring.jpa.entity.BaseUuidEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Auto Generate Javadoc
 *
 * @author michao
 *         日期:2018-02-07 17:12:22
 *         列表配置
 **/
@Access(AccessType.FIELD)
@Entity
@Table(name = "sys_table_config")
@DynamicInsert
@DynamicUpdate
@Data
public class TableConfig extends BaseUuidEntity {

    @Column(name = "TABLE_ID", length = 50)
    private String tableId;

    @Column(name = "EDIT_COLUMN", length = 3)
    private boolean editColumn;


    @Column(name = "TABLE_AUTOCREATE", length = 1)
    private boolean autoCreate;

    @Column(name = "TABLE_CHECKBOX", length = 3)
    private boolean checkbox;

    @Column(name = "TABLE_PAGESIZE", length = 10)
    private Integer pageSize;

    @Column(name = "TABLE_PAGINATION", length = 3)
    private boolean pagination;

    @Column(name = "TABLE_PK", length = 25)
    private String tablePk;

    @Column(name = "TABLE_TITLE", length = 100)
    private String tableTitle;

    @Column(name = "TABLE_URL", length = 150)
    private String tableUrl;

    @Column(name = "TABLE_TOOLBAR", length = 150)
    private String toolbar;


    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    @JoinColumn(name = "TABLE_ID")
    @JsonIgnore
    private List <TableHeadConfig> tableHeads = new ArrayList <>();


}
